package com.yuhs.zixing.study.design.pattern.dp001.principle.p03.dependency.inversion;

/**
 * @description 依赖传递 接口传递
 * @author: yuhs
 * @date 2022/3/25 下午7:57
 */
public class DependencyPassDemo001 {
    public static void main(String[] args) {
        ChangHong1 changHong = new ChangHong1();
        OpenAndClose openAndClose = new OpenAndClose();
        openAndClose.open(changHong);
    }
}


interface TVInterface1 {
    void play();
}

class ChangHong1 implements TVInterface1 {
    @Override
    public void play() {
        System.out.println("长虹电视播放西游记");
    }
}


interface OpenAndCloseInterface1 {
    void open(TVInterface1 tvInterface);
}

class OpenAndClose implements OpenAndCloseInterface1{

    @Override
    public void open(TVInterface1 tvInterface) {
        tvInterface.play();
    }
}
